package com.base.pig.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.base.pig.dto.IdDto;
import com.base.pig.dto.SensorListDto;
import com.base.pig.dto.TableDto;
import com.base.pig.entity.AlarmSetting;
import com.base.pig.mapper.AlarmSettingMapper;

import com.base.pig.service.AlarmSettingService;
import com.base.pig.vo.SensorListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 报警参数设置 服务实现类
 * </p>
 *allSensorList
 * @author wzx
 * @since 2022-04-12
 */
@Service
public class AlarmSettingServiceImpl extends ServiceImpl<AlarmSettingMapper, AlarmSetting> implements AlarmSettingService {

    @Autowired
    private AlarmSettingMapper alarmSettingMapper;

    @Override
    public IPage<SensorListVo> noBindSensorList(SensorListDto sensorListDto){
        IPage<SensorListVo> page = new Page<>(sensorListDto.getCurrent(), sensorListDto.getSize());
        List<SensorListVo> vo = alarmSettingMapper.noBindSensorList(page,sensorListDto);
        return page.setRecords(vo);
    }
    @Override
    public IPage<SensorListVo> bindSensorList(SensorListDto sensorListDto){
        IPage<SensorListVo> page = new Page<>(sensorListDto.getCurrent(), sensorListDto.getSize());
        List<SensorListVo> vo = alarmSettingMapper.bindSensorList(page,sensorListDto);
        return page.setRecords(vo);
    }

    @Override
    public List<SensorListVo> allSensorList(TableDto tableDto){
        List<SensorListVo> vo = alarmSettingMapper.allSensorList(tableDto);
        return vo;
    }

    @Override
    public String[] bindSensorArray(IdDto idDto){
        String[] vo = alarmSettingMapper.bindSensorArray(idDto);
        return vo;
    }

}
